var events = require("events");
var Emitter = events.EventEmitter;

function Cat(name,energy){
    Emitter.call(this);
    this.name = name;
    this.energy = energy;
}

Cat.prototype = Emitter.prototype;
(Cat.prototype).bark = function(){
    while(this.energy >= 0){
        console.log(this.name + "barked！" + "energy：" + this.energy);
    }
}

module.exports = Cat;